using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_AdminLogin : System.Web.UI.Page
{
    processUser pUser;
    protected void Page_Load(object sender, EventArgs e)
    {
        pUser = new processUser();
        txtAdminName.Focus();
    }


    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string adminname = txtAdminName.Text;
        string password = txtPassword.Text;
        if (pUser.checkAdmin(adminname, password)>0)
        {
            if (Session["AdminName"] == null || Session["AdminName"].ToString().Equals(""))
            {
                Session["AdminName"] = adminname;
                Session["AdminPassword"] = password;
                Session.Timeout = 30;
                Response.Redirect("AdminIndex.aspx");
            }
        }
        else
        {
            Alert.Show("User is not valid!");            
        }
    }
    protected void btnReset_Click(object sender, EventArgs e)
    {
        txtAdminName.Text = "";
        txtPassword.Text = "";
        txtAdminName.Focus();
    }
}
